<style type="text/css">
    .left-panel {
        float: left;
        width: 75%;
    }
    
    .right-panel {
        float: right;
        width: 20%;
        padding-left: 40px;
    }
</style>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl ?>/scripts/nicedit/nicEdit.js"></script>
<script type="text/javascript">
bkLib.onDomLoaded(function() {
	new nicEditor({
		//buttonList : ['bold','italic','underline','upload'],
		iconsPath:'<?php echo Yii::app()->baseUrl; ?>/scripts/nicedit/nicEditorIcons.gif',
		uploadURI : '<?php echo Yii::app()->baseUrl; ?>/scripts/nicedit/nicUpload.php', 
	}).panelInstance('description');
});

bkLib.onDomLoaded(function() {
	new nicEditor({
		//buttonList : ['bold','italic','underline','upload'],
		iconsPath:'<?php echo Yii::app()->baseUrl; ?>/scripts/nicedit/nicEditorIcons.gif',
		uploadURI : '<?php echo Yii::app()->baseUrl; ?>/scripts/nicedit/nicUpload.php', 
	}).panelInstance('short_intro');
});
</script>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl ?>/scripts/jquery/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
        var status = '<? echo $data['status']; ?>';
        $('#status').val(status);
        
        var category_id = '<? echo $data['category_id']; ?>';
        $('#category_id').val(category_id);
        
        var platform = '<? echo $data['platform']; ?>';
        $('#platform').val(platform);
        
        var graphic_type = '<? echo $data['graphic_type']; ?>';
        $('#graphic_type').val(graphic_type);
        
        var vote = '<? echo $data['vote']; ?>';
        $('#vote').val(vote);
        
        var context = '<? echo $data['context']; ?>';
        $('#context').val(context);
        
        var provider_id = '<? echo $data['provider_id']; ?>';
        $('#provider_id').val(provider_id);
        
        var release_type = '<? echo $data['release_type']; ?>';
        $('#release_type').val(release_type);
        
        var developer_id = '<? echo $data['developer_id']; ?>';
        $('#developer_id').val(developer_id);
        
        var hot_status = '<? echo $data['hot_status']; ?>';
        $('#hot_status').val(hot_status);
    });
</script>

<form name="create_form" id="create_form" method="POST" action="?r=game/edit&id=<?php echo $data['id'];?>" enctype="multipart/form-data">
    <div class="left-panel">
        <h3>Thông tin cơ bản</h3><hr />
        <table border="0">
            <tr>
                <td><label for="normal">Tên Game</label></td>
                <td><label for="normal">Trang chủ</label></td>
            </tr>
            <tr>
                <td><input name="name" id="name" value="<? echo $data['name'] ?>" type="text" size="70" style="width:329px"></td>
                <td><input type="text" value="<? echo $data['homepage'] ?>" name="homepage" id="homepage" style="width:329px"></td>
            </tr>
        </table>
        
        <table border="0">
            <tr>
                <td>
                    <label for="normal" style="width:240px">Thể loại</label>
                    <select name="category_id" id="category_id" style="opacity: 0;">
                        <?
                            foreach($pagevals['selection_label']['category'] as $key=> $value){
                                echo '<option class="selection_label" value="'.$key.'">'.ucfirst($value).'</option>';
                            }
                        ?>
                    </select>
                </td>
                <td>
                    <label for="normal" style="width:240px">Trạng thái</label>
                    <select name="status" id="status" style="opacity: 0;">
                        <option value="pending" selected="selected">Pending</option>
                        <option value="approved">Approved</option>
                        <option value="active">Active</option>
                        <option value="blocked">Blocked</option>
                    </select>
                </td>
                <td> 
                    <label for="normal" styl>Game Hot?</label>
                    <select name="hot_status" id="hot_status" style="opacity: 0;">
                        <option value="0">No</option>
                        <option value="1" selected="selected">Yes</option> 
                    </select>
                </td>
            </tr>
        </table>
        <br />
        <label for="normal">Giới thiệu</label>
        <textarea  id="short_intro" name="short_intro"  rows="3" style="width: 98%"><? echo $data['short_intro'] ?></textarea>
        <br />
        <label for="normal">Mô tả chi tiết</label>
        <textarea  id="description" name="description" rows="12"  style="width: 98%"><? echo $data['description'] ?></textarea>
        <br />
        <table border="0">
            <tr>
                <td width="300"> 
                    <label for="normal">Icon</label>
                    <input name="icon" id="icon" value="" type="file" size="20" style="opacity: 0;">
                    <input type ="hidden" name="icon" id="icon_url" value="<?php echo $data['icon']; ?>"/>
                </td>
                <td>
                    <label for="normal">Hình đại diện</label>
                    <input name="thumb" id="thumb" type="file"  size="20" style="opacity: 0;">
                    <input type ="hidden" name="thumb" id="thumb_url" value="<?php echo $data['thumb']; ?>"/>
                </td>
                
            </tr>
            <tr>
                <td>     
                    <div><img id="icon_content" src="<?php echo $data['icon']; ?>" style="width:200px;height:200px;margin-top:15px "></img></div>
                    <div id="icon_status"></div>
                </td>
                <td>
                    <div><img id="thumb_content" src="<?php echo $data['thumb']; ?>" style="width:200px;height:200px;margin-top:15px"></img></div>
                    <div id="thumb_status"></div>
                </td>
            </tr>
        </table>
        <br />
        <label for="normal">Screenshots</label>
         <input name="screenshot" id="screenshot" class="screenshot" type="file"  size="20" style="opacity: 0;">
         <input type="hidden" name="screenshots" id="screenshots_url" type="text" value='<?php echo $data['screenshots'];?>'/>
         <table>
             <tr>
                 <td id="screenshots_content" align="center">
                     <?php 
                        if($data['screenshots'] != '' && $data['screenshots'] != null){
                            $images = explode(';', $data['screenshots']);
                            foreach($images as $image){
                                if($image != ''){
                                    $screenshot = '<div id="'.$image.'" style="float:left;margin:10px 10px 0px 0px;width:100px;">';
                                    $screenshot .='<img src="'.$image.'" class="screenshot_image" style="width:100px;height:100px;" ></img>';
                                    $screenshot .='<a href="javascript:void(0)" title="'.$image.'" onclick="removeScreenshot(this.title);">Remove</a>';
                                    $screenshot .='</div>';
                                    echo $screenshot;
                                }
                            }
                        }
                     ?>
                 </td>
             </tr>
         </table>
         <span style="clear:left"></span>
         <br />
         <label>Tags</label>
         <input name="tags" id="tag" value="<? echo $data['tags'] ?>" type="text" size="70">
         
         <label>Thời gian phát hành</label>
         <input name="release_time" id="release_time" value="<? echo $data['release_time'] ?>" type="text" size="70">
         <br /><br />
         <center>
         <button class="btn" id="update_game" href="#"><span class="icon16 icomoon-icon-cog"></span> Update game</button>
         <button class="btn" id="cancel" href="?r=game"><span class="icon16 icomoon-icon-cog"></span> Cancel</button>
         </center>
    </div>
    
    
    <div class="right-panel">
        <h3>Thông tin liên quan </h3><hr />
        <label for="normal">Nền tảng</label>
        <select name="platform" id="platform" style="opacity: 0;">
            <?
                foreach($pagevals['selection_label']['platform'] as$key=> $value){
                     echo '<option class="selection_label" value="'.$value.'">'.ucfirst($value).'</option>';
                }
            ?>
        </select>
        <br /><br /> 
        <input type="text" name="new_platform" value="" style="width:182px" placeholder="Nền tảng"/>
        <br /><br /> 
        <label for="normal">Bối cảnh</label>
        <select name="context" id="context" style="opacity: 0;">
            <?
                foreach($pagevals['selection_label']['context'] as$key=> $value){
                     echo '<option class="selection_label" value="'.$value.'">'.ucfirst($value).'</option>';
                }
            ?>
        </select>
        <br /><br /> 
        <input type="text" name="new_context" value="" style="width:182px" placeholder="Bối cảnh"/>
        <br /><br />
        <label for="normal">Đồ họa</label>
        <select name="graphic_type" id="graphic_type" style="opacity: 0;">
            <option value="2D" selected="selected">2D</option>
            <option value="3D">3D</option>
        </select><br /><br />
        <label for="normal">Màn hình</label>
        <select name="screen_style" id="screen_style" style="opacity: 0;">
            <?
                foreach($pagevals['selection_label']['screen_style'] as $key=> $value){
                   echo '<option class="selection_label" value="'.$value.'">'.ucfirst($value).'</option>';
                }
            ?>
        </select><br /><br />
        <label for="normal">Bình chọn</label>
        <select name="vote" id="vote" style="opacity: 0;">
            <option value="5" selected="selected">5</option>
            <option value="4">4</option>
            <option value="3">3</option>
            <option value="2">2</option>
            <option value="1">1</option>
        </select><br /><br />
        <label for="normal">Nhà phát hành</label>
        <select name="provider_id" id="provider_id" style="opacity: 0;">
            <?
                foreach($pagevals['selection_label']['provider'] as $key=> $value){
                    echo '<option class="selection_label" value="'.$key.'">'.ucfirst($value).'</option>';
                }
            ?>
        </select><br /><br />
        <label for="normal">Nhà phát triển</label>
        <select name="developer_id" id="developer_id" style="opacity: 0;">
            <?
                foreach($pagevals['selection_label']['developer'] as $key=> $value){
                    echo '<option class="selection_label" value="'.$key.'">'.ucfirst($value).'</option>';
                }
            ?>
        </select><br /><br />
        
        <label for="normal">Phiên bản</label>
        <select name="release_type" id="release_type" style="opacity: 0;">
            <?
                foreach($pagevals['selection_label']['release_type'] as $key=> $value){
                   echo '<option class="selection_label" value="'.$value.'">'.ucfirst($value).'</option>';
                }
            ?>
        </select>
        <br /><br /> 
        <input type="text" name="new_release_type" value="" style="width:182px" placeholder="Phiên bản"/>
        <br /><br />
       </div>
    <span style="clear: both"></span>
</form>
